// SolarPositionDialog.cpp : implementation file
//

#include "../stdafx.h"
#include "../Reflectometry.h"
#include "SolarPositionDialog.h"
#include "afxdialogex.h"

#include "../MainFrm.h"
#include "../ReflectometryDoc.h"
#include "../sky/Sun.h"
#include "../base/Base.h"


// CSolarPositionDialog dialog

IMPLEMENT_DYNAMIC(CSolarPositionDialog, CDialogEx)

CSolarPositionDialog::CSolarPositionDialog(CWnd* pParent /*=NULL*/)
	: CDialogEx(CSolarPositionDialog::IDD, pParent)
	, m_elevationAngle(0)
	, m_azimuthAngle(0)
{
	//	get the pointer to the sun
	CMainFrame* pMainFrame = (CMainFrame *)AfxGetMainWnd();
	CReflectometryDoc* pDoc = (CReflectometryDoc *)(pMainFrame->GetActiveDocument());
	CSun* pSun = pDoc->GetClearSky()->GetSun();
	CSpherePosition position = pSun->GetSolarPosition();
	m_elevationAngle = position.m_elevation;
	m_azimuthAngle = position.m_azimuth;
}

CSolarPositionDialog::~CSolarPositionDialog()
{
}

void CSolarPositionDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT_ELEVATION, m_elevationAngle);
	DDX_Text(pDX, IDC_EDIT_AZIMUTH, m_azimuthAngle);
}


BEGIN_MESSAGE_MAP(CSolarPositionDialog, CDialogEx)
END_MESSAGE_MAP()


// CSolarPositionDialog message handlers
